package com.bolehui.web;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bolehui.base.result.Result;
import com.bolehui.domain.po.Summary;
import com.bolehui.domain.vo.SummaryVO;
import com.bolehui.service.SummaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chendongjie
 * @since 2025-03-18
 */
@RestController
@RequestMapping("/summary")
public class SummaryController {

    @Autowired
    private SummaryService summaryService;

    @RequestMapping(params = "action=saveSummary")
    public Result saveSummary(@RequestBody SummaryVO summaryVO, Long userId){
        return summaryService.saveSummary(summaryVO, userId);
    }

    @RequestMapping(params = "action=list")
    public Result list(Long userId){
        return Result.success(summaryService.list(new QueryWrapper<Summary>().eq("candidate_id", userId)));
    }

    @RequestMapping(params = "action=update")
    public Result update(@RequestBody SummaryVO summaryVO, Long userId){
        return summaryService.update(summaryVO, userId);
    }

    @RequestMapping(params = "action=delete")
    public Result delete(Long id){
        return Result.success(summaryService.removeById(id));
    }
}

